package com.itheima.IO流.day01.字节缓冲流BufferedOutputStream;

import java.io.*;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        //method1() ;
        //method2();



    }

    //字符缓冲流字节数组
    public static void method2() throws IOException {
        BufferedInputStream bis=new BufferedInputStream(new FileInputStream("day10的IO流01\\5.png"));
        BufferedOutputStream bus=new BufferedOutputStream(new FileOutputStream("day10的IO流01\\copy1.png",true));
        int b;
        byte[] bys=new byte[1024];
        while ((b=bis.read(bys))!=-1){
            bus.write(bys,0,b);
        }
        bis.close();
        bus.close();
    }

    //字符缓冲流单个字节;
    public static void method1() throws IOException {
        BufferedInputStream bis=new BufferedInputStream(new FileInputStream("day10的IO流01\\5.png"));
        BufferedOutputStream bus=new BufferedOutputStream(new FileOutputStream("day10的IO流01\\copy.png",true));
        int b;
        while ((b=bis.read())!=-1){
            bus.write(b);
        }
        bis.close();
        bus.close();
    }
}
